home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / WASTE 1.3a1.sit / WASTE 1.3a1 Distribution / WASTE C_C++ Headers / WASTE.h < prev   
Encoding:
C/C++ Source or Header  |  1996-08-23  |  38.8 KB  |  872 lines

  1. /*
  2.  *    WASTE.h
  3.  *
  4.  *    C/C++ interface to the WASTE text engine
  5.  *
  6.  *    version 1.3a1 (August 1996)
  7.  *
  8.  *    Copyright (c) 1993-1996 Marco Piovanelli
  9.  *    All Rights Reserved
  10.  *
  11.  */
  12.  
  13. #ifndef _WASTE_
  14. #define _WASTE_
  15.  
  16. #ifndef __CONDITIONALMACROS__
  17. #include <ConditionalMacros.h>
  18. #endif
  19.  
  20. #ifndef UNIVERSAL_INTERFACES_VERSION
  21. #error "You need Universal Headers version 2.1 or newer to use WASTE.h"
  22. #endif
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27.  
  28. #ifndef __MIXEDMODE__
  29. #include <MixedMode.h>
  30. #endif
  31.  
  32. #ifndef __QUICKDRAWTEXT__
  33. #include <QuickdrawText.h>
  34. #endif
  35.  
  36. #ifndef __QUICKDRAW__
  37. #include <Quickdraw.h>
  38. #endif
  39.  
  40. #ifndef __SCRIPT__
  41. #include <Script.h>
  42. #endif
  43.  
  44. #ifndef __TEXTUTILS__
  45. #include <TextUtils.h>
  46. #endif
  47.  
  48. #ifndef __TEXTEDIT__
  49. #include <TextEdit.h>
  50. #endif
  51.  
  52. #ifndef __DRAG__
  53. #include <Drag.h>
  54. #endif
  55.  
  56. #ifndef __LONGCOORDINATES__
  57. #ifndef _LongCoords_
  58. #include "LongCoords.h"
  59. #endif
  60. #endif
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. #if PRAGMA_ALIGN_SUPPORTED
  67. #pragma options align=mac68k
  68. #endif
  69.  
  70. #if PRAGMA_IMPORT_SUPPORTED
  71. #pragma import on
  72. #endif
  73.  
  74. //    The macro WASTE_VERSION expands to the current version of WASTE,
  75. //    expressed in standard NumVersion format (see Types.h)
  76. //    The macro WASTE11 is obsolete but still supported for backward
  77. //    compatibility
  78.  
  79. #define WASTE_VERSION    0x01304001        /* 1.3a1 */
  80. #define WASTE11
  81.  
  82. /*    result codes */
  83.  
  84. enum {
  85.     weCantUndoErr            =    -10015,    /* undo buffer is clear (= errAECantUndo) */
  86.     weEmptySelectionErr        =    -10013,    /* selection range is empty (= errAENoUserSelection) */
  87.     weNotHandledErr            =    -1708,    /* please use default behavior (= errAEEventNotHandled) */
  88.     weUnknownObjectTypeErr    =    -9478,    /* specified object type is not registered */
  89.     weObjectNotFoundErr        =    -9477,    /* no object found at specified offset */
  90.     weReadOnlyErr            =    -9476,    /* instance is read-only */
  91.     weUndefinedSelectorErr    =    -50        /* unknown selector (= paramErr) */
  92. };
  93.  
  94. /*    alignment styles */
  95.  
  96. enum {
  97.     weFlushLeft         =    -2,        /* flush left */
  98.     weFlushRight        =    -1,        /* flush right */
  99.     weFlushDefault        =     0,        /* flush according to system direction */
  100.     weCenter            =     1,        /* centered */
  101.     weJustify            =     2        /* fully justified */
  102. };
  103.  
  104. /*    primary line direction */
  105.  
  106. enum {
  107.     weDirDefault        =     1,        /* according to system direction */
  108.     weDirRightToLeft    =    -1,        /* force right-to-left */
  109.     weDirLeftToRight    =     0        /* force left-to-right */
  110. };
  111.  
  112. /*    values for the mode parameter in WESetStyle and WEContinuousStyle */
  113.  
  114. enum {
  115.     weDoFont                =    0x0001,
  116.     weDoFace                =    0x0002,
  117.     weDoSize                =    0x0004,
  118.     weDoColor                =    0x0008,
  119.     weDoAll                    =    weDoFont + weDoFace + weDoSize + weDoColor,
  120.     weDoAddSize                =    0x0010,
  121.     weDoToggleFace            =    0x0020,
  122.     weDoReplaceFace            =    0x0040,
  123.     weDoPreserveScript        =    0x0080,
  124.     weDoExtractSubscript    =    0x0100,
  125.     weDoFaceMask            =    0x0200
  126. };
  127.  
  128. /*    values for the edge parameter in WEGetOffset etc. */
  129.  
  130. enum {
  131.     kLeadingEdge = -1,        /* point is on the leading edge of a glyph */
  132.     kTrailingEdge = 0,        /* point is on the trailing edge of a glyph */
  133.     kObjectEdge = 2            /* point is in the middle of an embedded object */
  134. };
  135.  
  136. /*    values for WEFeatureFlag feature parameter */
  137.  
  138. enum {
  139.     weFAutoScroll        =    0,        /* automatically scroll the selection range into view */
  140.     weFOutlineHilite    =    2,        /* frame selection when deactivated */
  141.     weFReadOnly            =    5,        /* disallow modifications */
  142.     weFUndo                =    6,        /* support WEUndo() */
  143.     weFIntCutAndPaste    =    7,        /* use intelligent cut-and-paste rules */
  144.     weFDragAndDrop        =    8,        /* support drag-and-drop text editing */
  145.     weFInhibitRecal        =    9,        /* don't recalculate line starts and don't redraw text */
  146.     weFUseTempMem        =    10,        /* use temporary memory for main data structures */
  147.     weFDrawOffscreen    =    11,        /* draw text offscreen for smoother visual results */
  148.     weFInhibitRedraw    =    12,        /* don't redraw text */
  149.     weFMonoStyled        =    13,        /* disallow style changes */
  150.     weFInhibitColor        =    31        /* draw in black & white only */
  151. };
  152.  
  153. /*    values for WENew flags parameter */
  154.  
  155. enum {
  156.     weDoAutoScroll        =    1L << weFAutoScroll,
  157.     weDoOutlineHilite    =    1L << weFOutlineHilite,
  158.     weDoReadOnly        =    1L << weFReadOnly,
  159.     weDoUndo            =    1L << weFUndo,
  160.     weDoIntCutAndPaste    =    1L << weFIntCutAndPaste,
  161.     weDoDragAndDrop        =    1L << weFDragAndDrop,
  162.     weDoInhibitRecal    =    1L << weFInhibitRecal,
  163.     weDoUseTempMem        =    1L << weFUseTempMem,
  164.     weDoDrawOffscreen    =    1L << weFDrawOffscreen,
  165.     weDoInhibitRedraw    =    1L << weFInhibitRedraw,
  166.     weDoMonoStyled        =    1L << weFMonoStyled,
  167.     weDoInhibitColor    =    1L << weFInhibitColor
  168. };
  169.  
  170. /*    values for WEFeatureFlag action parameter */
  171.  
  172. enum {
  173.     weBitToggle = -2,    /* toggles the specified feature */
  174.     weBitTest,            /* returns the current setting of the specified feature */
  175.     weBitClear,            /* disables the specified feature */
  176.     weBitSet            /* enables the specified feature */
  177. };
  178.  
  179. /*    selectors for WEGetInfo and WESetInfo */
  180.  
  181. enum {
  182.     weCharByteHook                =    'cbyt', /* CharByte hook */
  183.     weCharToPixelHook            =    'c2p ',    /* CharToPixel hook */
  184.     weCharTypeHook                =    'ctyp', /* CharType hook */
  185.     weClickLoop                    =    'clik',    /* click loop callback */
  186.     weCurrentDrag                =    'drag',    /* drag currently being tracked from WEClick() */
  187.     weDrawTextHook                =    'draw', /* text drawing hook */
  188.     weEraseHook                    =    'eras', /* background erasing hook */
  189.     weHiliteDropAreaHook        =    'hidr', /* drop area highlighting hook */
  190.     weLineBreakHook                =    'lbrk',    /* line breaking hook */
  191.     wePixelToCharHook            =    'p2c ', /* PixelToChar hook */
  192.     wePort                        =    'port',    /* graphics port */
  193.     weRefCon                    =    'refc',    /* reference constant for use by application */
  194.     weScrollProc                =    'scrl',    /* auto-scroll callback */
  195.     weText                        =    'text',    /* text handle */
  196.     weTranslateDragHook         =    'xdrg', /* drag translation callback */
  197.     weTranslucencyThreshold        =    'tluc', /* area threshold for translucent drags */
  198.     weTSMDocumentID                =    'tsmd',    /* Text Services Manager document ID */
  199.     weTSMPreUpdate                =    'pre ',    /* Text Services Manager pre-update callback */
  200.     weTSMPostUpdate                =    'post',    /* Text Services Manager post-update callback */
  201.     weURLHint                    =    'urlh',    /* URL hint string for Internet Config */
  202.     weWordBreakHook                =    'wbrk'    /* word breaking hook */
  203. };
  204.  
  205. /*    values for WEInstallObjectHandler handlerSelector parameter */
  206.  
  207. enum {
  208.     weNewHandler        =    'new ',        /* new handler */
  209.     weDisposeHandler    =    'free',        /* dispose handler */
  210.     weDrawHandler        =    'draw',        /* draw handler */
  211.     weClickHandler        =    'clik',        /* click handler */
  212.     weStreamHandler        =    'strm'        /* stream handler */
  213. };
  214.  
  215. /*    action kinds */
  216.  
  217. enum {
  218.     weAKNone            =    0,        /* null action */
  219.     weAKUnspecified        =    1,        /* action of unspecified nature */
  220.     weAKTyping            =    2,        /* some text has been typed in */
  221.     weAKCut                =    3,        /* the selection range has been cut */
  222.     weAKPaste            =    4,        /* something has been pasted */
  223.     weAKClear            =    5,        /* the selection range has been deleted */
  224.     weAKDrag            =    6,        /* drag and drop operation */
  225.     weAKSetStyle        =    7        /* some style has been applied to a text range */
  226. };
  227.  
  228. /*    destination kinds for stream handler */
  229.  
  230. enum {
  231.     weToScrap            =    0,
  232.     weToDrag            =    1,
  233.     weToSoup            =    2
  234. };
  235.  
  236. typedef struct OpaqueWEReference *WEReference;
  237. typedef struct OpaqueWEObjectReference *WEObjectReference;
  238. typedef Handle WESoupHandle;
  239. typedef Handle WEFontTableHandle;
  240. typedef SInt16 WEActionKind;
  241. typedef SInt8 WEAlignment;
  242. typedef SInt16 WEDirection;
  243. typedef SInt8 WEEdge;
  244. typedef UInt16 WEStyleMode;
  245. typedef FourCharCode WESelector;
  246. typedef WEReference WEHandle;    /* obsolete, kept for backward compatibility */
  247.  
  248. typedef struct WERunInfo {
  249.     SInt32                 runStart;    /* byte offset to first character of style run */
  250.     SInt32                 runEnd;        /* byte offset past last character of style run */
  251.     SInt16                 runHeight;    /* line height (ascent + descent + leading) */
  252.     SInt16                 runAscent;    /* font ascent */
  253.     TextStyle             runStyle;    /* text attributes */
  254.     WEObjectReference    runObject;    /* either nil or reference to embedded object */
  255. } WERunInfo;
  256.  
  257.  
  258. /*    callback prototypes */
  259.  
  260. typedef pascal Boolean (*WEClickLoopProcPtr)(WEReference we);
  261. typedef pascal void (*WEScrollProcPtr)(WEReference we);
  262. typedef pascal void (*WETSMPreUpdateProcPtr)(WEReference we);
  263. typedef pascal void (*WETSMPostUpdateProcPtr)(WEReference we,
  264.         SInt32 fixLength, SInt32 inputAreaStart, SInt32 inputAreaEnd,
  265.         SInt32 pinRangeStart, SInt32 pinRangeEnd);
  266. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference theDrag,
  267.         ItemReference theItem, FlavorType requestedType, Handle putDataHere);
  268. typedef pascal OSErr (*WEHiliteDropAreaProcPtr)(DragReference theDrag,
  269.         Boolean hiliteFlag, WEReference we);
  270. typedef pascal OSErr (*WEFontIDToNameProcPtr)(SInt16 fontID, Str255 fontName);
  271. typedef pascal OSErr (*WEFontNameToIDProcPtr)(ConstStr255Param fontName, SInt16 oldFontID, SInt16 *newFontID);
  272. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  273.         JustStyleCode styleRunPosition, WEReference we);
  274. typedef pascal SInt32 (*WEPixelToCharProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  275.         Fixed *pixelWidth, WEEdge *edge, JustStyleCode styleRunPosition, Fixed hPos, WEReference we);
  276. typedef pascal SInt16 (*WECharToPixelProcPtr)(Ptr pText, SInt32 textLength, Fixed slop,
  277.         SInt32 offset, SInt16 direction, JustStyleCode styleRunPosition, SInt16 hPos, WEReference we);
  278. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, SInt32 textLength,
  279.         SInt32 textStart, SInt32 textEnd, Fixed *textWidth, SInt32 *textOffset, WEReference we);
  280. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, SInt16 textLength, SInt16 offset,
  281.         WEEdge edge, OffsetTable breakOffsets, ScriptCode script, WEReference we);
  282. typedef pascal SInt16 (*WECharByteProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script,
  283.         WEReference we);
  284. typedef pascal SInt16 (*WECharTypeProcPtr)(Ptr pText, SInt16 textOffset, ScriptCode script, WEReference we);
  285. typedef pascal void (*WEEraseProcPtr)(const Rect *area, WEReference we);
  286. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  287.         WEObjectReference obj);
  288. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectReference obj);
  289. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  290.         WEObjectReference obj);
  291. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, EventModifiers modifiers, UInt32 clickTime,
  292.         WEObjectReference obj);
  293. typedef pascal OSErr (*WEStreamObjectProcPtr)(SInt16 destKind, FlavorType *theType,
  294.         Handle putDataHere, WEObjectReference obj);
  295.  
  296.  
  297. /*    UPP proc info */
  298.  
  299. enum {
  300.     uppWEClickLoopProcInfo = kPascalStackBased
  301.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  302.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/)))
  303. };
  304. enum {
  305.     uppWEScrollProcInfo = kPascalStackBased
  306.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/)))
  307. };
  308. enum {
  309.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  310.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/)))
  311. };
  312. enum {
  313.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  314.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEReference /*we*/)))
  315.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*fixLength*/)))
  316.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*inputAreaStart*/)))
  317.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*inputAreaEnd*/)))
  318.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt32 /*pinRangeStart*/)))
  319.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 /*pinRangeEnd*/)))
  320. };
  321. enum {
  322.     uppWETranslateDragProcInfo = kPascalStackBased
  323.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  324.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  325.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*theItem*/)))
  326.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  327.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  328. };
  329. enum {
  330.     uppWEHiliteDropAreaProcInfo = kPascalStackBased
  331.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  332.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  333.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(Boolean /*hiliteFlag*/)))
  334.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(WEReference /*we*/)))
  335. };
  336. enum {
  337.     uppWEFontIDToNameProcInfo = kPascalStackBased
  338.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  339.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(SInt16 /*fontID*/)))
  340.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(StringPtr /*fontName*/)))
  341. };
  342. enum {
  343.     uppWEFontNameToIDProcInfo = kPascalStackBased
  344.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  345.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(ConstStr255Param /*fontName*/)))
  346.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*oldFontID*/)))
  347.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 * /*newFontID*/)))
  348. };
  349. enum {
  350.     uppWEDrawTextProcInfo = kPascalStackBased
  351.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  352.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  353.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  354.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  355.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEReference /*we*/)))
  356. };
  357. enum {
  358.     uppWEPixelToCharProcInfo = kPascalStackBased
  359.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt32)))
  360.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  361.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  362.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  363.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  364.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEEdge * /*edge*/)))
  365.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  366.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  367.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEReference /*we*/)))
  368. };
  369. enum {
  370.     uppWECharToPixelProcInfo = kPascalStackBased
  371.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  372.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  373.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  374.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  375.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*offset*/)))
  376.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(SInt16 /*direction*/)))
  377.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  378.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(SInt16 /*hPos*/)))
  379.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEReference /*we*/)))
  380. };
  381. enum {
  382.     uppWELineBreakProcInfo = kPascalStackBased
  383.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  384.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  385.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt32 /*textLength*/)))
  386.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt32 /*textStart*/)))
  387.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(SInt32 /*textEnd*/)))
  388.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  389.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(SInt32 * /*textOffset*/)))
  390.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEReference /*we*/)))
  391. };
  392. enum {
  393.     uppWEWordBreakProcInfo = kPascalStackBased
  394.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  395.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textLength*/)))
  396.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(SInt16 /*offset*/)))
  397.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEEdge /*edge*/)))
  398.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  399.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  400.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEReference /*we*/)))
  401. };
  402. enum {
  403.     uppWECharByteProcInfo = kPascalStackBased
  404.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  405.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  406.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  407.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  408.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEReference /*we*/)))
  409. };
  410. enum {
  411.     uppWECharTypeProcInfo = kPascalStackBased
  412.         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16 )))
  413.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  414.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(SInt16 /*textOffset*/)))
  415.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode /*script*/)))
  416.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEReference /*we*/)))
  417. };
  418. enum {
  419.     uppWEEraseProcInfo = kPascalStackBased
  420.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*area*/)))
  421.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEReference /*we*/)))
  422. };
  423. enum {
  424.     uppWENewObjectProcInfo = kPascalStackBased
  425.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  426.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  427.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*obj*/)))
  428. };
  429. enum {
  430.     uppWEDisposeObjectProcInfo = kPascalStackBased
  431.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  432.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectReference /*obj*/)))
  433. };
  434. enum {
  435.     uppWEDrawObjectProcInfo = kPascalStackBased
  436.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  437.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  438.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectReference /*obj*/)))
  439. };
  440. enum {
  441.     uppWEClickObjectProcInfo = kPascalStackBased
  442.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  443.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  444.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(EventModifiers /*modifiers*/)))
  445.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(UInt32 /*clickTime*/)))
  446.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectReference /*obj*/)))
  447. };
  448. enum {
  449.     uppWEStreamObjectProcInfo = kPascalStackBased
  450.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  451.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16 /*destKind*/)))
  452.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FlavorType * /*theType*/)))
  453.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  454.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WEObjectReference /*obj*/)))
  455. };
  456.  
  457.  
  458. /*    UPPs, NewナProc macros & CallナProc macros */
  459.  
  460. /*
  461.     NOTE:
  462.     For compatibility with the Pascal version, CallナProc macros take the form:
  463.  
  464.         CallFooProc(..., userRoutine)
  465.  
  466.     instead of:
  467.  
  468.         CallFooProc(userRoutine, ...)
  469.  
  470. */
  471.  
  472. #if GENERATINGCFM
  473.  
  474. typedef UniversalProcPtr WEClickLoopUPP;
  475. typedef UniversalProcPtr WEScrollUPP;
  476. typedef UniversalProcPtr WETSMPreUpdateUPP;
  477. typedef UniversalProcPtr WETSMPostUpdateUPP;
  478. typedef UniversalProcPtr WETranslateDragUPP;
  479. typedef UniversalProcPtr WEHiliteDropAreaUPP;
  480. typedef UniversalProcPtr WEFontIDToNameUPP;
  481. typedef UniversalProcPtr WEFontNameToIDUPP;
  482. typedef UniversalProcPtr WEDrawTextUPP;
  483. typedef UniversalProcPtr WEPixelToCharUPP;
  484. typedef UniversalProcPtr WECharToPixelUPP;
  485. typedef UniversalProcPtr WELineBreakUPP;
  486. typedef UniversalProcPtr WEWordBreakUPP;
  487. typedef UniversalProcPtr WECharByteUPP;
  488. typedef UniversalProcPtr WECharTypeUPP;
  489. typedef UniversalProcPtr WENewObjectUPP;
  490. typedef UniversalProcPtr WEEraseUPP;
  491. typedef UniversalProcPtr WEDisposeObjectUPP;
  492. typedef UniversalProcPtr WEDrawObjectUPP;
  493. typedef UniversalProcPtr WEClickObjectUPP;
  494. typedef UniversalProcPtr WEStreamObjectUPP;
  495.  
  496. #define NewWEClickLoopProc(userRoutine) ¥
  497.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  498. #define NewWEScrollProc(userRoutine) ¥
  499.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  500. #define NewWETSMPreUpdateProc(userRoutine) ¥
  501.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  502. #define NewWETSMPostUpdateProc(userRoutine) ¥
  503.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  504. #define NewWETranslateDragProc(userRoutine) ¥
  505.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  506. #define NewWEHiliteDropAreaProc(userRoutine) ¥
  507.     (WEHiliteDropAreaUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEHiliteDropAreaProcInfo, GetCurrentArchitecture())
  508. #define NewWEFontIDToNameProc(userRoutine) ¥
  509.     (WEFontIDToNameUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontIDToNameProcInfo, GetCurrentArchitecture())
  510. #define NewWEFontNameToIDProc(userRoutine) ¥
  511.     (WEFontNameToIDUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEFontNameToIDProcInfo, GetCurrentArchitecture())
  512. #define NewWEDrawTextProc(userRoutine) ¥
  513.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  514. #define NewWEPixelToCharProc(userRoutine) ¥
  515.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  516. #define NewWECharToPixelProc(userRoutine) ¥
  517.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  518. #define NewWELineBreakProc(userRoutine) ¥
  519.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  520. #define NewWEWordBreakProc(userRoutine) ¥
  521.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  522. #define NewWECharByteProc(userRoutine) ¥
  523.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  524. #define NewWECharTypeProc(userRoutine) ¥
  525.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  526. #define NewWEEraseProc(userRoutine) ¥
  527.     (WEEraseUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEEraseProcInfo, GetCurrentArchitecture())
  528. #define NewWENewObjectProc(userRoutine) ¥
  529.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  530. #define NewWEDisposeObjectProc(userRoutine) ¥
  531.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  532. #define NewWEDrawObjectProc(userRoutine) ¥
  533.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  534. #define NewWEClickObjectProc(userRoutine) ¥
  535.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  536. #define NewWEStreamObjectProc(userRoutine) ¥
  537.     (WEStreamObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEStreamObjectProcInfo, GetCurrentArchitecture())
  538.  
  539. #define CallWEClickLoopProc(we, userRoutine) ¥
  540.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (we))
  541. #define CallWEScrollProc(we, userRoutine) ¥
  542.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (we))
  543. #define CallWETSMPreUpdateProc(we, userRoutine) ¥
  544.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (we))
  545. #define CallWETSMPostUpdateProc(we, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) ¥
  546.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (we), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  547. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, userRoutine) ¥
  548.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (theDrag), (theItem), (requestedType), (putDataHere))
  549. #define CallWEHiliteDropAreaProc(theDrag, hiliteFlag, we, userRoutine) ¥
  550.     CallUniversalProc((userRoutine), uppWEHiliteDropAreaProcInfo, (theDrag), (hiliteFlag), (we))
  551. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) ¥
  552.     CallUniversalProc((userRoutine), uppWEFontIDToNameProcInfo, (fontID), (fontName))
  553. #define CallWEFontNameToIDProc(fontName, oldFontID, newFontID, userRoutine) ¥
  554.     CallUniversalProc((userRoutine), uppWEFontNameToIDProcInfo, (fontName), (oldFontID), (newFontID))
  555. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, we, userRoutine) ¥
  556.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (we))
  557. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, we, userRoutine) ¥
  558.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (we))
  559. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, we, userRoutine) ¥
  560.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (we))
  561. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, we, userRoutine) ¥
  562.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (we))
  563. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, we, userRoutine) ¥
  564.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (we))
  565. #define CallWECharByteProc(pText, textOffset, script, we, userRoutine) ¥
  566.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (we))
  567. #define CallWECharTypeProc(pText, textOffset, script, we, userRoutine) ¥
  568.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (we))
  569. #define CallWEEraseProc(area, we, userRoutine) ¥
  570.     CallUniversalProc((userRoutine), uppWEEraseProcInfo, (area), (we))
  571. #define CallWENewObjectProc(defaultObjectSize, obj, userRoutine) ¥
  572.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (obj))
  573. #define CallWEDisposeObjectProc(obj, userRoutine) ¥
  574.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (obj))
  575. #define CallWEDrawObjectProc(destRect, obj, userRoutine) ¥
  576.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (obj))
  577. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, obj, userRoutine) ¥
  578.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (obj))
  579. #define CallWEStreamObjectProc(destKind, theType, putDataHere, obj, userRoutine) ¥
  580.     CallUniversalProc((userRoutine), uppWEStreamObjectProcInfo, (destKind), (theType), (putDataHere), (obj))
  581.  
  582. #else
  583.  
  584. typedef WEClickLoopProcPtr WEClickLoopUPP;
  585. typedef WEScrollProcPtr WEScrollUPP;
  586. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  587. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  588. typedef WETranslateDragProcPtr WETranslateDragUPP;
  589. typedef WEHiliteDropAreaProcPtr WEHiliteDropAreaUPP;
  590. typedef WEFontIDToNameProcPtr WEFontIDToNameUPP;
  591. typedef WEFontNameToIDProcPtr WEFontNameToIDUPP;
  592. typedef WEDrawTextProcPtr WEDrawTextUPP;
  593. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  594. typedef WECharToPixelProcPtr WECharToPixelUPP;
  595. typedef WELineBreakProcPtr WELineBreakUPP;
  596. typedef WEWordBreakProcPtr WEWordBreakUPP;
  597. typedef WECharByteProcPtr WECharByteUPP;
  598. typedef WECharTypeProcPtr WECharTypeUPP;
  599. typedef WEEraseProcPtr WEEraseUPP;
  600. typedef WENewObjectProcPtr WENewObjectUPP;
  601. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  602. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  603. typedef WEClickObjectProcPtr WEClickObjectUPP;
  604. typedef WEStreamObjectProcPtr WEStreamObjectUPP;
  605.  
  606. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  607. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  608. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  609. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  610. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  611. #define NewWEHiliteDropAreaProc(userRoutine) ((WEHiliteDropAreaUPP) (userRoutine))
  612. #define NewWEFontIDToNameProc(userRoutine) ((WEFontIDToNameUPP) (userRoutine))
  613. #define NewWEFontNameToIDProc(userRoutine) ((WEFontNameToIDUPP) (userRoutine))
  614. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  615. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  616. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  617. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  618. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  619. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  620. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  621. #define NewWEEraseProc(userRoutine) ((WEEraseUPP) (userRoutine))
  622. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  623. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  624. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  625. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  626. #define NewWEStreamObjectProc(userRoutine) ((WEStreamObjectUPP) (userRoutine))
  627.  
  628. #define CallWEClickLoopProc(we, userRoutine) ¥
  629.     (*(userRoutine))((we))
  630. #define CallWEScrollProc(we, userRoutine) ¥
  631.     (*(userRoutine))((we))
  632. #define CallWETSMPreUpdateProc(we, userRoutine) ¥
  633.     (*(userRoutine))((we))
  634. #define CallWETSMPostUpdateProc(we, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) ¥
  635.     (*(userRoutine))((we), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  636. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, userRoutine) ¥
  637.     (*(userRoutine))((theDrag), (theItem), (requestedType), (putDataHere))
  638. #define CallWEHiliteDropAreaProc(theDrag, hiliteFlag, we, userRoutine) ¥
  639.     (*(userRoutine))((theDrag), (hiliteFlag), (we))
  640. #define CallWEFontIDToNameProc(fontID, fontName, userRoutine) ¥
  641.     (*(userRoutine))((fontID), (fontName))
  642. #define CallWEFontNameToIDProc(fontName, oldFontID, newFontID, userRoutine) ¥
  643.     (*(userRoutine))((fontName), (oldFontID), (newFontID))
  644. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, we, userRoutine) ¥
  645.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (we))
  646. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, we, userRoutine) ¥
  647.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (we))
  648. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, we, userRoutine) ¥
  649.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (we))
  650. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, we, userRoutine) ¥
  651.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (we))
  652. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, we, userRoutine) ¥
  653.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (we))
  654. #define CallWECharByteProc(pText, textOffset, script, we, userRoutine) ¥
  655.     (*(userRoutine))((pText), (textOffset), (script), (we))
  656. #define CallWECharTypeProc(pText, textOffset, script, we, userRoutine) ¥
  657.     (*(userRoutine))((pText), (textOffset), (script), (we))
  658. #define CallWEEraseProc(area, we, userRoutine) ¥
  659.     (*(userRoutine))((area), (we))
  660. #define CallWENewObjectProc(defaultObjectSize, obj, userRoutine) ¥
  661.     (*(userRoutine))((defaultObjectSize), (obj))
  662. #define CallWEDisposeObjectProc(obj, userRoutine) ¥
  663.     (*(userRoutine))((obj))
  664. #define CallWEDrawObjectProc(destRect, obj, userRoutine) ¥
  665.     (*(userRoutine))((destRect), (obj))
  666. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, obj, userRoutine) ¥
  667.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (obj))
  668. #define CallWEStreamObjectProc(destKind, theType, putDataHere, obj, userRoutine) ¥
  669.     (*(userRoutine))((destKind), (theType), (putDataHere), (obj))
  670.  
  671. #endif
  672.  
  673.  
  674. /*    WASTE public calls */
  675.  
  676. /*    getting the shared library version number */
  677.  
  678. extern pascal UInt32 /* NumVersion */ WEVersion(void);
  679.  
  680. /*    creation and destruction */
  681.  
  682. extern pascal OSErr WENew(const LongRect *destRect, const LongRect *viewRect, UInt32 flags, WEReference *we);
  683. extern pascal void WEDispose(WEReference we);
  684.  
  685. /*    getting variables */
  686.  
  687. extern pascal Handle WEGetText(WEReference we);
  688. extern pascal SInt16 WEGetChar(SInt32 offset, WEReference we);
  689. extern pascal SInt32 WEGetTextLength(WEReference we);
  690. extern pascal SInt32 WEGetHeight(SInt32 startLine, SInt32 endLine, WEReference we);
  691. extern pascal void WEGetSelection(SInt32 *selStart, SInt32 *selEnd, WEReference we);
  692. extern pascal void WEGetDestRect(LongRect *destRect, WEReference we);
  693. extern pascal void WEGetViewRect(LongRect *viewRect, WEReference we);
  694. extern pascal Boolean WEIsActive(WEReference we);
  695. extern pascal SInt32 WEOffsetToLine(SInt32 offset, WEReference we);
  696. extern pascal void WEGetLineRange(SInt32 lineIndex, SInt32 *lineStart, SInt32 *lineEnd, WEReference we);
  697. extern pascal SInt32 WECountLines(WEReference we);
  698. extern pascal SInt32 WEOffsetToRun(SInt32 offset, WEReference we);
  699. extern pascal void WEGetRunRange(SInt32 runIndex, SInt32 *runStart, SInt32 *runEnd, WEReference we);
  700. extern pascal SInt32 WECountRuns(WEReference we);
  701. extern pascal UInt16 WEGetClickCount(WEReference we);
  702.  
  703. /*    setting variables */
  704.  
  705. extern pascal void WESetSelection(SInt32 selStart, SInt32 selEnd, WEReference we);
  706. extern pascal void WESetDestRect(const LongRect *destRect, WEReference we);
  707. extern pascal void WESetViewRect(const LongRect *viewRect, WEReference we);
  708.  
  709. /*    accessing style run information */
  710.  
  711. extern pascal Boolean WEContinuousStyle(WEStyleMode *mode, TextStyle *ts, WEReference we);
  712. extern pascal void WEGetRunInfo(SInt32 offset, WERunInfo *runInfo, WEReference we);
  713.  
  714. /*    converting byte offsets to screen position and vice versa */
  715.  
  716. extern pascal SInt32 WEGetOffset(const LongPt *thePoint, WEEdge *edge, WEReference we);
  717. extern pascal void WEGetPoint(SInt32 offset, SInt16 direction, LongPt *thePoint, SInt16 *lineHeight, WEReference we);
  718.  
  719. /*    finding words and lines */
  720.  
  721. extern pascal void WEFindWord(SInt32 offset, WEEdge edge, SInt32 *wordStart, SInt32 *wordEnd, WEReference we);
  722. extern pascal void WEFindLine(SInt32 offset, WEEdge edge, SInt32 *lineStart, SInt32 *lineEnd, WEReference we);
  723.  
  724. /*    making a copy of a text range */
  725.  
  726. extern pascal OSErr WECopyRange(SInt32 rangeStart, SInt32 rangeEnd, Handle hText, StScrpHandle hStyles, WESoupHandle hSoup, WEReference we);
  727.  
  728. /*    getting and setting the alignment style */
  729.  
  730. extern pascal WEAlignment WEGetAlignment(WEReference we);
  731. extern pascal void WESetAlignment(WEAlignment alignment, WEReference we);
  732.  
  733. /*    getting and setting the primary line direction */
  734.  
  735. extern pascal WEDirection WEGetDirection(WEReference we);
  736. extern pascal void WESetDirection(WEDirection direction, WEReference we);
  737.  
  738. /*    recalculating line breaks, drawing and scrolling */
  739.  
  740. extern pascal OSErr WECalText(WEReference we);
  741. extern pascal void WEUpdate(RgnHandle updateRgn, WEReference we);
  742. extern pascal void WEScroll(SInt32 hOffset, SInt32 vOffset, WEReference we);
  743. extern pascal void WESelView(WEReference we);
  744.  
  745. /*    handling activate / deactivate events */
  746.  
  747. extern pascal void WEActivate(WEReference we);
  748. extern pascal void WEDeactivate(WEReference we);
  749.  
  750. /*     handling key-down events */
  751.  
  752. extern pascal void WEKey(SInt16 key, EventModifiers modifiers, WEReference we);
  753.  
  754. /*    handling mouse-down events and mouse tracking */
  755.  
  756. extern pascal void WEClick(Point hitPt, EventModifiers modifiers, UInt32 clickTime, WEReference we);
  757.  
  758. /*    adjusting the cursor shape */
  759.  
  760. extern pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEReference we);
  761.  
  762. /*    blinking the caret */
  763.  
  764. extern pascal void WEIdle(UInt32 *maxSleep, WEReference we);
  765.  
  766. /*    modifying the text and the styles */
  767.  
  768. extern pascal OSErr WEInsert(const void *pText, SInt32 textLength, StScrpHandle hStyles, WESoupHandle hSoup, WEReference we);
  769. extern pascal OSErr WEDelete(WEReference we);
  770. extern pascal OSErr WESetStyle(WEStyleMode mode, const TextStyle *ts, WEReference we);
  771. extern pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEReference we);
  772. extern pascal OSErr WEUseText(Handle hText, WEReference we);
  773.  
  774. /*    undo */
  775.  
  776. extern pascal OSErr WEUndo(WEReference we);
  777. extern pascal void WEClearUndo(WEReference we);
  778. extern pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEReference we);
  779. extern pascal Boolean WEIsTyping(WEReference we);
  780. extern pascal OSErr WEBeginAction(WEReference we);
  781. extern pascal OSErr WEEndAction(WEActionKind actionKind, WEReference we);
  782.  
  783. /*    keeping track of changes */
  784.  
  785. extern pascal UInt32 WEGetModCount(WEReference we);
  786. extern pascal void WEResetModCount(WEReference we);
  787.  
  788. /*    embedded objects */
  789.  
  790. extern pascal OSErr WEInstallObjectHandler(FlavorType objectType, WESelector handlerSelector, UniversalProcPtr handler, WEReference we);
  791. extern pascal OSErr WEGetObjectHandler(FlavorType objectType, WESelector handlerSelector, UniversalProcPtr *handler, WEReference we);
  792. extern pascal OSErr WEInsertObject(FlavorType objectType, Handle objectDataHandle, Point objectSize, WEReference we);
  793. extern pascal OSErr WEGetSelectedObject(WEObjectReference *obj, WEReference we);
  794. extern pascal SInt32 WEFindNextObject(SInt32 offset, WEObjectReference *obj, WEReference we);
  795. extern pascal OSErr WEUseSoup(WESoupHandle hSoup, WEReference we);
  796.  
  797. /*    accessing embedded object attributes */
  798.  
  799. extern pascal FlavorType WEGetObjectType(WEObjectReference obj);
  800. extern pascal Handle WEGetObjectDataHandle(WEObjectReference obj);
  801. extern pascal Point WEGetObjectSize(WEObjectReference obj);
  802. extern pascal WEReference WEGetObjectOwner(WEObjectReference obj);
  803. extern pascal SInt32 WEGetObjectRefCon(WEObjectReference obj);
  804. extern pascal void WESetObjectRefCon(WEObjectReference obj, SInt32 refCon);
  805.  
  806. /*    clipboard operations */
  807.  
  808. extern pascal OSErr WECut(WEReference we);
  809. extern pascal OSErr WECopy(WEReference we);
  810. extern pascal OSErr WEPaste(WEReference we);
  811. extern pascal Boolean WECanPaste(WEReference we);
  812.  
  813. /*    Drag Manager support */
  814.  
  815. extern pascal RgnHandle WEGetHiliteRgn(SInt32 rangeStart, SInt32 rangeEnd, WEReference we);
  816. extern pascal OSErr WETrackDrag(DragTrackingMessage message, DragReference drag, WEReference we);
  817. extern pascal OSErr WEReceiveDrag(DragReference drag, WEReference we);
  818. extern pascal Boolean WECanAcceptDrag(DragReference drag, WEReference we);
  819. extern pascal Boolean WEDraggedToTrash(DragReference drag);
  820.  
  821. /*    font tables */
  822.  
  823. extern pascal OSErr WEBuildFontTable(WEFontTableHandle hFontTable, WEFontIDToNameUPP fontIDToNameProc, WEReference we);
  824. extern pascal OSErr WEUpdateFontTable(WEFontTableHandle hFontTable, WEFontNameToIDUPP fontNameToIDProc, Boolean *wasChanged);
  825. extern pascal OSErr WEUpdateStyleScrap(StScrpHandle hStyles, WEFontTableHandle hFontTable);
  826.  
  827. /*    Script Manager utilities */
  828.  
  829. extern pascal SInt16 WECharByte(SInt32 offset, WEReference we);
  830. extern pascal SInt16 WECharType(SInt32 offset, WEReference we);
  831.  
  832. /*    Text Services Manager support */
  833.  
  834. extern pascal OSErr WEInstallTSMHandlers(void);
  835. extern pascal OSErr WERemoveTSMHandlers(void);
  836. extern pascal void WEStopInlineSession(WEReference we);
  837.  
  838. /*    additional features */
  839.  
  840. extern pascal SInt16 WEFeatureFlag(SInt16 feature, SInt16 action, WEReference we);
  841. extern pascal OSErr WEGetInfo(WESelector selector, void *info, WEReference we);
  842. extern pascal OSErr WESetInfo(WESelector selector, const void *info, WEReference we);
  843.  
  844. /*    getting and setting user-defined info */
  845.  
  846. extern pascal OSErr WEGetUserInfo(WESelector tag, SInt32 *userInfo, WEReference we);
  847. extern pascal OSErr WESetUserInfo(WESelector tag, SInt32 userInfo, WEReference we);
  848.  
  849. /*    long coordinate utilities */
  850.  
  851. extern pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  852. extern pascal void WEPointToLongPoint(Point p, LongPt *lp);
  853. extern pascal void WESetLongRect(LongRect *lr, SInt32 left, SInt32 top, SInt32 right, SInt32 bottom);
  854. extern pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  855. extern pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  856. extern pascal void WEOffsetLongRect(LongRect *lr, SInt32 hOffset, SInt32 vOffset);
  857. extern pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  858.  
  859. #if PRAGMA_IMPORT_SUPPORTED
  860. #pragma import off
  861. #endif
  862.  
  863. #if PRAGMA_ALIGN_SUPPORTED
  864. #pragma options align=reset
  865. #endif
  866.  
  867. #ifdef __cplusplus
  868. }
  869. #endif
  870.  
  871. #endif    /* _WASTE_ */
  872.